package syren;
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;

public class mainWindow {//implements ActionListener {
	
	JFrame frame;
	JTabbedPane menuContainer;
	String name;
	
	public void create(){
		frame = new JFrame("Syren");
		menuContainer = new JTabbedPane();
		JMenuItem create;
		JMenuItem load;
		frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

		
		//Menu bar containing Domain and Configuration drop down menus
		JMenuBar topBar = new JMenuBar();

		//Domain drop down menu
		JMenu topMenu = new JMenu("Domain");
		
		//Create + action listener
		create = new JMenuItem("Create Domain");
		create.addActionListener(new ActionListener(){
			public void actionPerformed(ActionEvent arg0) 
			{
				// TODO Create correct components to add to a panel, add that panel to menuContainer. 
				// Use Domain class to generate them. This class should be uploaded to the repository by the time
				//you read this.  Look at configuration class for a reference
				
			}
		});
		//Load + action listener
		load = new JMenuItem("Load Domain");
		load.addActionListener(new ActionListener(){
			public void actionPerformed(ActionEvent arg0) 
			{
				// TODO Auto-generated method stub
				
			}
		});
		//Adding create and load to topMenu 
		topMenu.add(create);
		topMenu.add(load);
		
		//adding top menu to topBar
		topBar.add(topMenu);

		//Configuration drop down menu 
		topMenu = new JMenu ("Configuration");
		//create + action listener
		create = new JMenuItem("Create Configuration");
		create.addActionListener(new ActionListener(){
			public void actionPerformed(ActionEvent arg0) 
			{
				menuContainer.addTab("Create Tab", new Configuration(1));
			}
		});
		//load + action listener
		load = new JMenuItem("Load Configuration");
		load.addActionListener(new ActionListener(){
			public void actionPerformed(ActionEvent arg0) 
			{
				menuContainer.addTab("Load Tab", new Configuration(0));
				
			}
		});
		//adding both to topMenu
		topMenu.add(create);
		topMenu.add(load);
		//adding this to topBar
		topBar.add(topMenu);

		frame.getContentPane().add(topBar, BorderLayout.NORTH);
		
		
		menuContainer.setPreferredSize(new Dimension(500, 500));
		frame.getContentPane().add(menuContainer,BorderLayout.CENTER);
		

		//Display the window.
		frame.pack();
		frame.setVisible(true);
	}

	public void save(){}


}